package com.wanmait.server.config;

import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
/**
* TODO
* @author 羽
* @date 2020/12/9 15:54
* @param
* @return
 * 访问静态资源的通用化配置
**/

@Configuration
public class WebConfig implements WebMvcConfigurer {
    //配置前端访问静态文件时的允许路径（js，css，img等）
    @Override
    public void addResourceHandlers(ResourceHandlerRegistry registry) {
        //当访问/statics/**时，去/statics/里寻找
        registry.addResourceHandler("/statics/**").addResourceLocations("classpath:/statics/");
    }
}
